package com.proxy.demo03;

import com.proxy.demo02.IGamePlayer;

public class GamePlayerProxy implements IGamePlayer {
    // 重点是代练内部引用了抽象玩家角色,并在实例化代理时,传递进来具体哪个玩家对象需要被代理.
    private IGamePlayer iGamePlayer;
    public GamePlayerProxy(IGamePlayer iGamePlayer){
        this.iGamePlayer = iGamePlayer;
    }

    @Override
    public void login(String userName, String password) {
        this.iGamePlayer.login(userName,password);
    }

    @Override
    public void killBoss() {
        this.iGamePlayer.killBoss();
    }

    @Override
    public void upgrade() {
        this.iGamePlayer.upgrade();
    }
}
